<template>
  <div>
    <MyContainer>
      <CategoryMenu/>
      <el-carousel trigger="click" height="360px">
        <el-carousel-item>
          <img src="@/assets/images/poster1.png" alt="" style="width: 100%;">
        </el-carousel-item>
        <el-carousel-item>
          <img src="@/assets/images/poster2.png" alt="" style="width: 100%;">
        </el-carousel-item>
        <el-carousel-item>
          <img src="@/assets/images/poster3.png" alt="" style="width: 100%;">
        </el-carousel-item>
      </el-carousel>
    </MyContainer>
    <ProductList :list="list"/>
  </div>
</template>

<script>
import MyContainer from '@/components/Me/MyContainer'
import CategoryMenu from "@/components/Me/CategoryMenu";
import {listProduct} from "@/api/system/product";
import ProductList from "@/views/fm/components/ProductList";

export default {
  name: 'IndexMain',
  components: {ProductList, CategoryMenu, MyContainer },
  data() {
    return {
      activeIndex: -1,
      list: [],
    }
  },
  methods: {
    selectStyle(item, index) {
      this.activeIndex = index
    },
    outStyle(item) {
      this.activeIndex = -1
    },
    listProduct() {
      listProduct({status:1}).then(res=>{
        res.rows.length=12
        this.list=res.rows
      })
    },
    toSearch(name){
      this.$router.push({path:'/fm/result',query: {name}})
    },
  },
  created() {
    this.listProduct()
  }
}
</script>

<style scoped>

</style>
